package com.atguigu.gmall.cart.config;


import com.atguigu.gmall.cart.exection.handler.CartExceptionHandler;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.stereotype.Component;

import java.util.concurrent.Executor;

@Component
public class AsyncConfig implements AsyncConfigurer {


    @Autowired
    CartExceptionHandler cartExceptionHandler;

    @Override
    public Executor getAsyncExecutor() {

        return null;
    }

    /**
     * 配置统一的异常处理
     * @return
     */
    @Override
    public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
        return cartExceptionHandler;
    }
}
